import React,{useState} from 'react';
import '../../styles/News/Tenement.scss'
const Tenement = (props) => {
  const [index] = useState( props.to.location.state.i)
  const [tenementlist] = useState(props.to.location.state.chatinfo[index].wanted)
  console.log(tenementlist);
  return (
    <div className='Tenement'>
      {tenementlist.map((v,i)=>{
        return <li className='t-information' key={i} onClick={
          ()=>{
            document.querySelector('footer').style.display='flex'
            props.to.history.push({pathname:'/rentlist',state:{i}})
          }
        }>
                <div className='t-content'>
                  <img src={v.wimg} alt=""/>
                  <span className='t-name'>{v.wusername}</span>
                  <span className='t-price'>{v.wprice}</span>
                </div>
                <h3>求{v.wname}</h3>
                <div className="ask">
                  <div className="ask-item">2020-11-22入住</div>
                  <div className="ask-item">不限男女</div>
                </div>  
                <p>{v.wintro}</p>
              </li>
      })}
      
    </div>
  );
}

export default Tenement;
